﻿<UserControl 
    x:Class="Microsoft.Samples.WindowsPhoneCloud.Phone.PivotContent.ListQueuesPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DataContext="{d:DesignData ../DesignData/ListQueuesPageViewModelSampleData.xaml}"    
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="768" d:DesignWidth="480">
    
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Orientation="Vertical">
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="Prefix" FontSize="{StaticResource PhoneFontSizeNormal}" FontFamily="{StaticResource PhoneFontFamilyNormal}" VerticalAlignment="Top" LineHeight="31" LineStackingStrategy="BlockLineHeight" Foreground="{StaticResource PhoneSubtleBrush}" TextWrapping="Wrap" Margin="12,0,12,-5"  />
                    <TextBox Text="{Binding Prefix, Mode=TwoWay}" />
                </StackPanel>
                
                <Button Grid.Row="1" Content="list queues" Margin="0" Click="OnListQueues" Width="228" HorizontalAlignment="Left" />
            </StackPanel>

            <ListBox Grid.Row="1" Margin="0,20,0,0" BorderThickness="0" ItemsSource="{Binding CloudQueues}" SelectionChanged="OnSelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Margin="12,15,12,15">
                            <Button Content="Delete" Style="{StaticResource ButtonDeleteStyle}" Click="OnDeleteQueue" Tag="{Binding}" />
                            <TextBlock Text="{Binding Name}" HorizontalAlignment="Left" VerticalAlignment="Center" TextDecorations="Underline"  FontFamily="{StaticResource PhoneFontFamilyLight}" FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{StaticResource PhoneForegroundBrush}" TextWrapping="Wrap" LineStackingStrategy="BlockLineHeight" LineHeight="43" Margin="10,0,0,0"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <TextBlock Grid.Row="1" Margin="12,20" Visibility="{Binding HasResults, Converter={StaticResource VisibilityConverter}, ConverterParameter=true}" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeLarge}" Text="No queues found." />
            
            <StackPanel Grid.Row="2" Margin="12,0,12,12" Orientation="Vertical" VerticalAlignment="Bottom">
                <TextBlock Text="{Binding Message}" HorizontalAlignment="Left" TextWrapping="Wrap" />
                <ProgressBar Height="20" IsIndeterminate="True" Visibility="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}" />
            </StackPanel>
        </Grid>
    </Grid>

</UserControl>